package com.ra.wr;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * RoomInfo的传输对象, 对应于WebRent中的RoomInfo
 * @author Guo
 * @date 2015年8月12日
 * @since v4.0
 */
public class RoomInfoTdo {
	
	//全部房源
	public static final Integer SEARCH_TYPE_ALL = -1;
	
	//分散式房源
	public static final Integer SEARCH_TYPE_DA = 0;
	
	//房源类型: 0 集中式
	public static final Integer SOURCE_TYPE_CA = 0;
	
	//房源类型: 1分散式
	public static final Integer SOURCE_TYPE_DA = 1;
	
	//用这个字段来判断
	private Integer searchType;
	
	//最早入住开始时间
	private Date beginDate;
	
	//最早入住结束时间
	private Date endDate;
	
	//--
	
	private Integer id;

	
	private Integer roomId;
	
	//房间信息类型: 0集中式; 1分散式;
	private Integer sourceType;
	
	// 所属楼房
	private BuildingInfoTdo buildingInfo;
	
	// 房间编号
	private String no;

	// 房间名
	private String name;
	
	// 房型，描述几房几厅
	private Integer roomType;

	// 租金
	private BigDecimal expectFee;
	
	// 最早入住日期
	private Date earliestDate;

	// 1为已发布, 0为未发布, 出租状态参见: rentState
	private Integer status;
	
	// 房间出租状态: 出租, 预定等, see Room.rentState
	private Integer rentState;
	
	// 发布标题
	private String publishTitle;
	
	// 备注
	private String remark;
	
	//管理员有权限的buildingId
	private List<Integer> buildingIds;
	
	//管理员有权限的suiteId
	private List<Integer> suiteIds;


	public boolean existBuildingIds()
	{
		return (buildingIds != null && !buildingIds.isEmpty());
	}
	
	public boolean existSuiteIds()
	{
		return (suiteIds != null && !suiteIds.isEmpty());
	}
	
	/**
	 * 获取buildingId集合的in字符串
	 * @param ids
	 * @return
	 */
	public String getInBuildingQl()
	{
		return getInQl(buildingIds);
	}
	
	/**
	 * 获取suiteId集合的in字符串
	 * @return
	 */
	public String getInSuiteQl()
	{
		return getInQl(suiteIds);
	}
	
	private String getInQl(List<Integer> ids)
	{
		StringBuilder inQl = new StringBuilder();
		inQl.append("(");
		for (Integer theId : ids) 
		{
			inQl.append(theId).append(",");
		}
		inQl.deleteCharAt(inQl.length() -1);
		inQl.append(")");
		return inQl.toString();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getRoomId() {
		return roomId;
	}

	public void setRoomId(Integer roomId) {
		this.roomId = roomId;
	}

	public Integer getSourceType() {
		return sourceType;
	}

	public void setSourceType(Integer sourceType) {
		this.sourceType = sourceType;
	}

	public BuildingInfoTdo getBuildingInfo()
	{
		return buildingInfo;
	}

	public void setBuildingInfo(BuildingInfoTdo buildingInfo)
	{
		this.buildingInfo = buildingInfo;
	}

	public String getNo() {
		return no;
	}

	public void setNo(String no) {
		this.no = no;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getRoomType() {
		return roomType;
	}

	public void setRoomType(Integer roomType) {
		this.roomType = roomType;
	}

	public BigDecimal getExpectFee() {
		return expectFee;
	}

	public void setExpectFee(BigDecimal expectFee) {
		this.expectFee = expectFee;
	}

	public Date getEarliestDate() {
		return earliestDate;
	}

	public void setEarliestDate(Date earliestDate) {
		this.earliestDate = earliestDate;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getRentState() {
		return rentState;
	}

	public void setRentState(Integer rentState) {
		this.rentState = rentState;
	}

	public Integer getSearchType()
	{
		return searchType;
	}

	public void setSearchType(Integer searchType)
	{
		this.searchType = searchType;
	}

	public Date getBeginDate()
	{
		return beginDate;
	}

	public void setBeginDate(Date beginDate)
	{
		this.beginDate = beginDate;
	}

	public Date getEndDate()
	{
		return endDate;
	}

	public void setEndDate(Date endDate)
	{
		this.endDate = endDate;
	}

	public String getPublishTitle()
	{
		return publishTitle;
	}

	public void setPublishTitle(String publishTitle)
	{
		this.publishTitle = publishTitle;
	}

	public String getRemark()
	{
		return remark;
	}

	public void setRemark(String remark)
	{
		this.remark = remark;
	}

	public List<Integer> getBuildingIds() {
		return buildingIds;
	}

	public void setBuildingIds(List<Integer> buildingIds) {
		this.buildingIds = buildingIds;
	}

	public List<Integer> getSuiteIds() {
		return suiteIds;
	}

	public void setSuiteIds(List<Integer> suiteIds) {
		this.suiteIds = suiteIds;
	}
}
